Skip to content

Create test.js#29

Open
cklein12 wants to merge 1 commit intomainfrom
cklein12-patch-29
Open

Create test.js#29
cklein12 wants to merge 1 commit intomainfrom
cklein12-patch-29

Conversation

@cklein12
Copy link
Owner

@cklein12 cklein12 commented Aug 8, 2024

Thank you for submitting a pull request to the WebGoat!

Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Jit has detected 1 important finding in this PR that you should review.
The finding is detailed below as a comment.
It’s highly recommended that you fix this security issue before merge.


// This is an unsafe practice and can lead to XSS vulnerabilities
const userInput = document.getElementById('userInput').value;
document.getElementById('content').innerHTML = userInput;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security control: Static Code Analysis Js

Type: Javascript.Browser.Security.Insecure-Document-Method.Insecure-Document-Method

Description: User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Severity: HIGH

Learn more about this issue


Fix suggestion:

This fix suggestion was generated by Jit. Please note that the suggestion might not always fit every use case. It is highly recommended that you check and review it before merging.

Suggestion guidelines

This remediation replaces the usage of insecure methods like 'innerHTML', 'outerHTML' or 'document.write' with a safer alternative, 'textContent'. The code will now use 'textContent' to safely set or update the content without putting your application at risk of XSS attacks.

Suggested change
document.getElementById('content').innerHTML = userInput;
document.getElementById('content').textContent = userInput;

Jit Bot commands and options (e.g., ignore issue)

You can trigger Jit actions by commenting on this PR review:

  • #jit_ignore_fp Ignore and mark this specific single instance of finding as “False Positive”
  • #jit_ignore_accept Ignore and mark this specific single instance of finding as “Accept Risk”
  • #jit_ignore_type_in_file Ignore any finding of type "javascript.browser.security.insecure-document-method.insecure-document-method" in test.js
  • #jit_undo_ignore Undo ignore command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant